<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./lib/jquery.js"></script>
</head>

<body>
    <script>
        $.ajax({
            // 超时的时间
            timeout: 300,
            type: "get",
            url: "http://www.liulongbin.top:3006/api/getbooks",
            success: function (res) {
                console.log(res);
            },
            // 捕获超时信息
            error: function (err) {
                console.log(err);
                console.log(err.statusText);
                // if (err.statusText == "timeout") {
                //     console.log('请求超时了');
                // }
            }
        });
    </script>
</body>

</html>